#include <string>
#include <vector>
#include "split.h"

using namespace std;
//using namespace stock_trade;

bool split(const string& sToBeSplited, const string& sSplitWord, vector<string> &vStrResult)
{
	if(sToBeSplited == "" || sSplitWord == "")
	{
		return false;
	}

	if(vStrResult.size() > 0)
	{
		vStrResult.clear();
	}
	
	string::size_type iBeginPos = 0, iEndPos;
	int iLengthSplitWord = sSplitWord.length();
	while((iEndPos = sToBeSplited.find(sSplitWord, iBeginPos)) != string::npos)
	{
		vStrResult.push_back(sToBeSplited.substr(iBeginPos, iEndPos - iBeginPos));
		iBeginPos = iEndPos + iLengthSplitWord;
	}
//添加最后一段
//	if(iBeginPos != 0)
	vStrResult.push_back(sToBeSplited.substr(iBeginPos));
	return true;
}
